import Cookies from 'js-cookie'

const site = {
  state: {
    siteId: Cookies.get('siteId') ? parseInt(Cookies.get('siteId')) : null
  },
  mutations: {
    SET_SITEID: (state, data) => {
      state.siteId = data
      Cookies.set('siteId', data)
    }
  },
  actions: {
    setSiteId({ commit }, data) {
      commit('SET_SITEID', data)
    }
  }
}

export default site
